#!/bin/sh

! command -v gnuplot >/dev/null 2>&1 && \
    echo 'gnuplot not found - skipping graph creation' && \
    exit 1

# Formatting
format () {
    cat<<EOF
set term pngcairo size 750,500
set xlabel 'x (m)'
set key left top
set xtics 0.05
EOF
}

graphFile=postProcessing/graph/0.002/line.xy
cfdFmt="title 'CFD' w lp ls 1 lw 1"
dataFmt="title 'Schulein (1996)' w p ls 2 lw 1"

# Plotting
gnuplot<<EOF
    $(format)
    set output 'Cf.png'
    set ylabel 'C_{f} (-)'
    plot "$graphFile" u 1:2 $cfdFmt, \
         "schulein1996Cf.txt" u 1:2 $dataFmt
EOF

gnuplot<<EOF
    $(format)
    set output 'p.png'
    set ylabel 'p (Pa)'
    plot "$graphFile" u 1:3 $cfdFmt, \
         "schulein1996P.txt" u 1:2 $dataFmt
EOF

#------------------------------------------------------------------------------
